<div class="title">
  <h1>Angriffe</h1>
</div>

<div class="content">

  <table>
    <tr>
    <th class="heading-position">Position</th>
    <th class="heading-timestamp">Zeitpunkt</th>
    <th class="heading-opponent">Gegner</th>
    <th class="heading-armies">Armeen</th>
    <th class="heading-result">Gewonnen</th>
    <% for attack in @attacks %>
      <tr class="line">
        <td class="def" id="center"><%= link_to position(attack), attack %></td>
        <td class="def"><%=h attack.zeitpunkt %></td>
        <td class="def">
          <% if attack.defenders.count > 0 %>
            <%=h attack.defenders.join(", ") %>
          <% end %>
        </td>
        <td class="def">
          <% if attack.armies.count > 0 %>
            <%=h attack.armies.join(", ") %>
          <% end %>
        </td>
        <td class="def">
          <% if attack.result %>
            Ja
          <% else %>
            Nein
          <% end %>
        </td>
        <td id="buttons"><%= link_to 'Edit', edit_attack_path(attack) %></td>
        <td id="buttons"><%= link_to 'Destroy', attack, :confirm => 'Are you sure?', :method => :delete %></td>
      </tr>
    <% end %>
  </table>
</div>


<% content_for :navigation do %>
  <li>
    <%= link_to 'Neuer Angriff', new_attack_path %>
  </li>
<% end %>